export const getInputs = () => [
	[
		[
			[0, 1],
			[1, 0],
		],
		[
			[1, 0],
			[0, 1],
		],
	],
	[
		[
			[0, 1],
			[1, 1],
		],
		[
			[1, 0],
			[0, 1],
		],
	],
	[
		[
			[0, 0, 0],
			[0, 1, 0],
			[1, 1, 1],
		],
		[
			[1, 1, 1],
			[0, 1, 0],
			[0, 0, 0],
		],
	],
	[
		[
			[0, 0, 0],
			[0, 0, 1],
			[0, 0, 1],
		],
		[
			[0, 0, 0],
			[0, 0, 1],
			[0, 0, 1],
		],
	],
];

/**
 * **[1886. 判断矩阵经轮转后是否一致](https://leetcode.cn/problems/determine-whether-matrix-can-be-obtained-by-rotation/)**
 *
 * 给你两个大小为 `n x n` 的二进制矩阵 `mat` 和 `target` 。现 **以 90 度顺时针轮转** 矩阵 `mat` 中的元素 **若干次** ，如果能够使 `mat` 与 `target` 一致，返回 `true` ；否则，返回 `false` 。
 *
 * @param mat
 * @param target
 * @returns
 */
export default function (mat: number[][], target: number[][]): boolean {
	const length = mat.length;

	let a = true,
		b = true,
		c = true,
		d = true;

	for (let x = 0; x < length; x++) {
		for (let y = 0; y < length; y++) {
			const targetValue = target[x][y];

			if (a && targetValue !== mat[x][y]) {
				a = false;
			}

			if (b && targetValue !== mat[y][length - x - 1]) {
				b = false;
			}

			if (c && targetValue !== mat[length - x - 1][length - y - 1]) {
				c = false;
			}

			if (d && targetValue !== mat[length - y - 1][x]) {
				d = false;
			}

			if (!a && !b && !c && !d) return false;
		}
	}

	return true;
}
